package com.corpdata.system.province.service.impl;

import java.util.HashMap;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.corpdata.common.utils.CorpdataUtil;
import com.corpdata.core.base.AbstractBaseService;
import com.corpdata.system.province.dao.SysProvinceCityMapper;
import com.corpdata.system.province.entity.SysProvinceCity;
import com.corpdata.system.province.service.SysProvinceCityService;
import com.corpdata.system.security.shiro.util.UserUtil;

/**
 * 三级联动省份城市区域
 * 
 * @author wu
 * @email 64088839@qq.com
 * @date 2018-06-19 10:59:28
 */
@Service
@Transactional
public class SysProvinceCityServiceImpl extends AbstractBaseService<SysProvinceCity> implements SysProvinceCityService {
	
	protected final Logger logger = LoggerFactory.getLogger(this.getClass());  
	
	@Autowired
	private SysProvinceCityMapper sysProvinceCityMapper;
	
	/**
	 * 获取下拉json数据
	 * @return
	 */
	public String findByCombox(String parentId,String type){
		Map<String,Object> params=new HashMap<String,Object>();
		if(parentId!=null&&!"".equals(parentId)){
			params.put("parentId", parentId);
		}
		if(type!=null&&!"".equals(type)){
			params.put("type", type);
		}
		String json = CorpdataUtil.getComboxJson(sysProvinceCityMapper.selectAllByCombox(params));
		return json;
	}
}
